<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Commission extends Model
{   
    protected $table = 'commissions';
    //
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'order_user_id',
        'commission_user_id',
        'orderno',
        'amount',
        'commission',
        'commission_user_level',
        'note',
        'status'
    ];

    public function status(){
        $status = ['未结算','已结算','已作废'];
        return $status[$this->status];
    }

    public function statuslabel(){
        $status = ['label-primary ','label-success','label-danger'];
        return $status[$this->status];
    }

    public function order_user(){
        return $this->belongsTo('App\User','order_user_id');
    }   

    public function commission_user(){
        return $this->belongsTo('App\User','commission_user_id');
    } 

}
